
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div style="display: flex; align-items: center; justify-content: center;">
        <canvas id="canvas" width="1000" height="500"></canvas>
    </div>


    <script>
        

        const canvas = document.querySelector('#canvas')
        const ctx = canvas.getContext('2d')

        // 2. 绘制矩形路径
        ctx.rect(100, 100, 100, 100);

        // 3. 绘制描边矩形
        ctx.strokeRect(300, 100, 100, 100);

        // 4. 绘制填充矩形
        ctx.fillRect(500, 100, 100, 100);
        

    </script>
    
</body>
</html>